﻿using System.Windows;
using Bookvar.ObjectModel.Actions;

namespace Bookvar.UI.DragDrop.Actions
{
    public class TopicMoveDropAction : TopicDropActionBase
    {
        public override void Execute( CompositeAction compositeAction, TopicContentPresenter presenter, Point dropPoint )
        {
            var offset = new Point( dropPoint.X - presenter.X, dropPoint.Y - presenter.Y );
            var changePositionAction =
                new ChangeTopicPositionByOffsetAction( presenter.Topic, offset, presenter.Owner.Mindmap, true );

            compositeAction.Add( changePositionAction );
            ActionService.Execute( compositeAction );
        }
    }
}